package com.supermap.search.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.supermap.search.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by wyw on 2017/3/29.
 */
public class XiaoTieShiActivity extends AppCompatActivity {
    @BindView(R.id.lv_xiaotieshi)
    ListView lvXiaotieshi;
    private String[] data;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xiaotieshi);
        ButterKnife.bind(this);
        data = new String[]{"一、光缆管道巡检工作","二、光缆管道维护工作","三、场区施工管理","四、光缆管道保障预案","五、考核制度"
        };
        initdata();
    }

    private void initdata() {
        lvXiaotieshi.setAdapter(new MyAdapter() {
        });
        lvXiaotieshi.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(XiaoTieShiActivity.this,TieShiXiangQingActivity.class);
                intent.putExtra("a",position);
                startActivity(intent);
            }
        });
    }

    private class MyAdapter extends BaseAdapter{

        @Override
        public int getCount() {
            return data.length;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
          View view = View.inflate(XiaoTieShiActivity.this, R.layout.item_xiaotieshi,null);
            TextView tv_xiaotieshi = (TextView) view.findViewById(R.id.tv_xiaotiesh);
            tv_xiaotieshi.setText(data[position]);
            return view;
        }
    }
}
